<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@	page import="java.util.ArrayList"%>
<%@	page import="kau.dao.*"%>
<%@	page import="kau.vo.*"%>

<html>
<head>
<title>AdmincustInformation</title>
<script>
	function check_mail(frm) {

		if (frm.email_list.value != "" && frm.email_list.value != "self") {
			frm.mailDomain.value = frm.email_list.value;
			frm.mailDomain.readOnly = true;
		} else if (frm.email_list.value == "self") {
			frm.mailDomain.value = '';
			frm.mailDomain.readOnly = false;
			frm.mailDomain.focus();
		} else if (frm.email_list.value == "") {
			frm.mailDomain.value = '';
			frm.mailDomain.readOnly = true;
		}
	}
		function check_question(frm){
		if (frm.question_list.value != "" && frm.question_list.value != "self") {
			frm.passwordQuestion.value = frm.question_list.value;
			frm.passwordQuestion.readOnly = true;
		} else if (frm.question_list.value == "self") {
			frm.passwordQuestion.value = '';
			frm.passwordQuestion.readOnly = false;
			frm.passwordQuestion.focus();
		} else if (frm.question_list.value == "") {
			frm.passwordQuestion.value = '';
			frm.passwordQuestion.readOnly = true;
		}
		
	}
	function checkForm() {
		var password = document.getElementById("password").value;
		var mailAccount = document.getElementById("mailAccount").value;
		var phoneNumber1 = document.getElementById("phoneNumber1").value;
		var phoneNumber2 = document.getElementById("phoneNumber2").value;
		var phoneNumber3 = document.getElementById("phoneNumber3").value;
		
		var parentPhoneNumber1 = document.getElementById("parentPhoneNumber1").value;
		var parentPhoneNumber2 = document.getElementById("parentPhoneNumber2").value;
		var parentPhoneNumber3 = document.getElementById("parentPhoneNumber3").value;
		
		var passwordAnswer = document.getElementById("passwordAnswer").value;
		var selectLevel= document.getElementById("custLevel").value;
		
		if(mailAccount == null|| mailAccount ==""){
			alert("메일주소를 입력하세요");
			document.getElementById("mailAccount").focus();
			return false;
		}else if(password == null|| password ==""){
			alert("비밀번호를 입력하세요");
			document.getElementById("password").focus();
			return false;
		}else if(phoneNumber1.length!=3){
			alert("핸드폰번호를 확인하세요");
			document.getElementById("phoneNumber1").focus();
			return false;
		} else if(phoneNumber2.length < 3 || phoneNumber2.length > 4){
			alert("핸드폰번호를 확인하세요");
			document.getElementById("phoneNumber2").focus();
			return false;
		} else if(phoneNumber3.length!=4){
			alert("핸드폰번호를 확인하세요");
			document.getElementById("phoneNumber3").focus();
			return false;
		}else if(parentPhoneNumber1.length!=3){
			alert("부모님 핸드폰번호를 확인하세요");
			document.getElementById("parentPhoneNumber1").focus();
			return false;
		} else if(parentPhoneNumber2.length < 3 || parentPhoneNumber2.length > 4){
			alert("부모님 핸드폰번호를 확인하세요");
			document.getElementById("parentPhoneNumber2").focus();
			return false;
		} else if(parentPhoneNumber3.length!=4){
			alert("부모님 핸드폰번호를 확인하세요");
			document.getElementById("parentPhoneNumber3").focus();
			return false;
		}
		else if(passwordAnswer == null || passwordAnswer==""){
			alert("질문에 대한 답을 입력하세요");
			document.getElementById("passwordAnswer").focus();
			return false;
		}
		else if(selectLevel=='0'){
			alert("레벨을 선택하세요");
			return false;
		}
		else{
			alert("회원정보가 수정되었습니다.");
			return true;
		}
			
	}

</script>
<style type="text/css">
#info {
	font-family: 맑은 고딕, dotum, sans-serif, bold;
	font-size: 13px
}
</style>

<style type="text/css">
<!--
@import url("/nems/css/style.css");
-->
</style>
</head>
<body>
	<div style="margin-left: 20px" id="info">
		<form class="form-inline" id="custForm"
			action="update_cust_admin.cust?custId=${requestScope.customer.custId}">

			<br>
			<div id="info">
				<table align="left" style="margin-left: 20px" id="info">
					<tr>

						<td width="60" height="50"><img
							src="/nems/admin/images/cust.png" width="40" /></td>

						<td>
							<h4
								style="font-weight: bold; color: #005700; text-align: left; font-size: 20px;">회원수정</h4>
						</td>
					</tr>
				</table>

				<br> <br> <br> <br> <br> <br>
				<hr  style="width:670px">

				<center>
					<table border="0" style="width: 600px">

						<tr align="left">
							<td width="300" height="35">ID</td>
							<input type="hidden" name="custId"
								value="${requestScope.customer.custId}" />
							<td width="300">${requestScope.customer.custId}</td>
						</tr>


						<tr align="left">
							<td height="35">Password</td>
							<td><input class="input-xlarge" id="password" type="text"
								name="password" value="${requestScope.customer.password}"></td>
						</tr>

						<tr align="left">
							<td height="35">이름</td>
							<td><input class="input-xlarge" id="disabledInput"
								type="text" name="custName"
								value="${requestScope.customer.custName}" disabled></td>
						</tr>

						<tr align="left">
							<td height="35">주민등록번호</td>
							<td><input class="input-xlarge" id="disabledInput"
								type="text" name="custSsn"
								value="${requestScope.customer.custSsn}" disabled></td>
						</tr>

						<tr align="left">
							<td width="300" height="45">Email</td>

							<td width="300" height="45"><input type="text" size="10"
								value="${requestScope.customer.custEmailAccount}"
								name="mailAccount" id="mailAccount" title="이메일 아이디 입력" /> @ <input
								type="text" size="10"
								value="${requestScope.customer.custEmailDomain}"
								name="mailDomain" title="이메일 도메인 입력" readonly="readonly" /> <select
								name="email_list" id="email_list"
								onchange="check_mail(this.form);">
									<option value="${requestScope.customer.custEmailDomain}"
										selected='selected'>선택해 주세요.</option>
									<option value="naver.com">naver.com</option>
									<option value="chol.com">chol.com</option>
									<option value="dreamwiz.com">dreamwiz.com</option>
									<option value="empal.com">empal.com</option>
									<option value="freechal.com">freechal.com</option>
									<option value="gmail.com">gmail.com</option>
									<option value="hanafos.com">hanafos.com</option>
									<option value="hanmail.net">hanmail.net</option>
									<option value="hanmir.com">hanmir.com</option>
									<option value="hitel.net">hitel.net</option>
									<option value="hotmail.com">hotmail.com</option>
									<option value="korea.com">korea.com</option>
									<option value="lycos.co.kr">lycos.co.kr</option>
									<option value="nate.com">nate.com</option>
									<option value="netian.com">netian.com</option>
									<option value="paran.com">paran.com</option>
									<option value="yahoo.com">yahoo.com</option>
									<option value="yahoo.co.kr">yahoo.co.kr</option>
									<option value="self">직접입력</option>
							</select>
						</tr>

						<tr align="left">
							<td width="300" height="35">핸드폰번호</td>
							<td width="300"><input type="text" name="phoneNumber1"
								id="phoneNumber1" size="3" maxlength="3" onKeyPress="num_only()"
								value="${requestScope.customer.phoneNumber1}" /> - <input
								type="text" id="phoneNumber2" name="phoneNumber2" size="4"
								maxlength="4" onKeyPress="num_only()"
								value="${requestScope.customer.phoneNumber2}" /> - <input
								type="text" name="phoneNumber3" id="phoneNumber3" size="4"
								maxlength="4" onKeyPress="num_only()"
								value="${requestScope.customer.phoneNumber3}" /></td>
						</tr>

						<tr align="left">
							<td width="300" height="35">부모님 핸드폰번호</td>
							<td width="300"><input type="text" name="parentPhoneNumber1"
								id="parentPhoneNumber1" size="3" maxlength="3"
								onKeyPress="num_only()"
								value="${requestScope.customer.parentPhoneNumber1}" /> - <input
								type="text" id="parentPhoneNumber2" name="parentPhoneNumber2"
								size="4" maxlength="4" onKeyPress="num_only()"
								value="${requestScope.customer.parentPhoneNumber2}" /> - <input
								type="text" name="parentPhoneNumber3" id="parentPhoneNumber3"
								size="4" maxlength="4" onKeyPress="num_only()"
								value="${requestScope.customer.parentPhoneNumber3}" /></td>
						</tr>

						<tr align="left">
							<td width="300" height="45">비밀번호 찾기 질문</td>
							<td width="300" height="45"><input type="text" size="30"
								value="${requestScope.customer.passwordQuestion}"
								name="passwordQuestion" title="비밀번호찾기질문" /> <select
								id="question_list" name="question_list"
								onchange="check_question(this.form);">
									<option value="${requestScope.customer.passwordQuestion}">선택하세요</option>
									<option value="본인의 출생지는?">본인의 출생지는?</option>
									<option value="나의 출신 초등학교는?">나의 출신 초등학교는?</option>
									<option value="나의 좌우명은?">나의 좌우명은?</option>
									<option value="가장 생각나는 친구 이름은?">가장 생각나는 친구 이름은?</option>
									<option value="나의 보물 제1호는?">나의 보물 제1호는?</option>
							</select></td>
						</tr>
						<tr align="left">

							<td width="300" height="35">비밀번호 찾기 답</td>
							<td width="300"><input type="text" id="passwordAnswer"
								name="passwordAnswer"
								value="${requestScope.customer.passwordAnswer}" /></td>
						</tr>

						<tr align="left">
							<td height="35">가입 일자</td>
							<td><input class="input-xlarge" id="disabledInput"
								type="text" name="joinDate"
								value="${requestScope.customer.joinDate}" disabled></td>
						</tr>


						<tr align="left">
							<td height="35">등급</td>
							<td><select id="custLevel" name="custLevel">
									<option value="0">등급을 선택하세요</option>
									<option value="1">1.관리자</option>
									<option value="2">2.강사</option>
									<option value="3">3.학생</option>
									<option value="4">4.권한없음</option>
							</select></td>
						</tr>


					</table>
				</center>
				<hr  style="width:670px">
				<br >
				<br>
				<button class="positive" style="width: 70px" type="submit"
					onclick="return checkForm()">
					<img src="cust/img/shopping_cart_accept.png"
						style="width: 20px; height: 10px" />확인
				</button>

				<button class="negative" style="width: 70px"
					onclick="javascript:history.go(-1)">
					<img src="cust/img/shopping_cart_accept.png"
						style="width: 20px; height: 10px" />취소
				</button>

			</div>
		</form>
	</div>
</body>
</html>
